// 引入注册函数
import {getinfo} from '@/axios/index'

const state = {
  userInfo: {
    name: '张三',
    like:'看动作',
    age: 18
  },
  Personalinfo:{}
}
const actions = {
  //获取用户信息并储存用户信息
  async getinfo({commit}){
    const result = await getinfo()
    if(result.nickName){
      commit('GET_INFO',result)
    }else{
      console.log('获取失败')
    }
  }
}
const mutations = {
  //将注册验证码储存
  GET_CODE(state,data){
    state.code = data
  },
  //储存个人信息
  GET_INFO(state,data){
    state.Personalinfo = data
  },
  //清除个人信息
  removeinfo(state){
    state.Personalinfo={}
  }
}

const getters = {
}

export default {

  state,
  actions,
  mutations,
  getters

}